package com.configclient.configclient;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableEurekaClient
@RestController
//刷新配置 手动刷新/actuator/refresh  （此请求为post方式content-type 请设置为json，不然访问不到）
@RefreshScope
public class ConfigclientApplication {

	@Value("${name}")
	private String name;


	@Value("${demo.title}")
	private String title;

	@GetMapping("/name")
	public String getName(){
		return name;
	}

	@GetMapping("/title")
	public String geTitle(){
		return title;
	}


	public static void main(String[] args) {

		SpringApplication.run(ConfigclientApplication.class, args);
	}

}
